package com.da.javatest.leetCode;

/**
 * @author chenlida
 * @date 2018/12/24 14:54
 * @description
 */
public class Code48 {
    public static void main(String[] args) {
        new Code48().rotate(new int[][] {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
    }

    public void rotate(int[][] matrix) {
        int[][] temp = new int[matrix.length][matrix.length];
        int max = matrix.length - 1;
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix.length; j++) {
                temp[i][j] = matrix[i][j];
            }
        }

        for (int i = 0; i < temp.length; i++) {
            for (int j = 0; j < temp.length; j++) {
                matrix[j][max - i] = temp[i][j];
            }
        }
    }
}
